<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content=
"HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
<title>Reconditioned Machines</title>
<link rel="stylesheet" href="home.css" type="text/css" />
</head>
<body>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content=
"HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
<title>Reconditioned Machines</title>
<link rel="stylesheet" href="home.css" type="text/css" />

</head>
<body>
<center>
<?php
include 'menu.php';
verifySession();
connectDB();

if($_POST["action"] == "Delete")
{
  $machineQuery = mysql_query(
            "SELECT thumblink, piclink FROM reconditioned WHERE machineID =  " . $_GET['machineID']);
   if (!$machineQuery) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
  $machineRow = mysql_fetch_array($machineQuery);
  unlink($machineRow["thumblink"]);
  unlink($machineRow["piclink"]);

  $sql="DELETE FROM reconditioned WHERE machineID = " . $_GET['machineID'];
  mysql_query($sql);

  header("location:reconditioned_admin.php");
}

  
  // Request the categories
  $machineQuery = mysql_query(
            "SELECT * FROM reconditioned WHERE machineID =  " . $_GET['machineID']);
   if (!$machineQuery) {
    echo("<P>Error performing query: " .
         mysql_error() . "</P>");
    exit();
  }
$machineRow = mysql_fetch_array($machineQuery);
echo("<p>Are you sure you want to delete this record?</p>");
?>

<table class="reconditioned" width="770px">
<tr>
<td class="majHeading" width="10%">UNIT #</td>
<td class="majHeading" width="75%">UNIT INFORMATION</td>
<td class="majHeading" width="10%">PRICE</td>
<td class="majHeading" width="5%">
<center><img src="images/photo.gif" alt="" /></center>
</td>
</tr>
<?php
echo("<tr><td class='caps'>" . $machineRow["cowtag"] . "</td>");
	echo("<td class='caps'>" . $machineRow["description"] . "</td>");
	echo("<td width='20%'>$" . $machineRow["price"] . "</td>");
	if (!empty($machineRow["piclink"]) && !empty($machineRow["piclink"])) {
	  echo("<td align='center'><a href=\"javascript:PopupPic('" . $machineRow["piclink"] . "')\">");
	  echo("<img src=\"" . $machineRow["thumblink"] . "\" height='60' /></a></td></tr></table>");
	}
	else
	  echo("<td align='center'><img src='pictures/reconditioned/nopicthumb.jpg' height='60' /></td></tr></table>");

//echo("<p><a href='confirmDelete.php?machineID=" . $_GET['machineID'] . "'>[DELETE] </a>");
//echo("<a href='reconditioned_admin.php'> [Cancel]</a></p>");
?>
<form method="POST" enctype="multipart/form-data" name="image_upload_form" action="<?$_SERVER["PHP_SELF"];?>">
<p><input type="submit" value="Delete" name="action"></p>
<a href='reconditioned_admin.php'> [Cancel]</a></p>
</form>



<p></p>

</center>
</body>
</html>